home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 1 Issue 2 / PDCD-1 - Issue 02.iso / _utilities / utilities / 001 / inform / Inform / z / dejavu next >
Text File  |  1993-09-08  |  66KB  |  2,121 lines

  1. ! ---------------------------------------------------------------------------------------------------
  2. ! Inform Demonstration
  3. ! ---------------------------------------------------------------------------------------------------
  4.  
  5. Constant Story "DEJA VU";
  6.  
  7. Release 1;
  8.  
  9. Attribute light;
  10. Attribute concealed;
  11. Attribute worn;
  12. Attribute clothing;
  13. Attribute animate;
  14. Attribute proper;
  15. Attribute moved;
  16. Attribute portal;
  17. Attribute container;
  18. Attribute interior;
  19. Attribute open;
  20. Attribute openable;
  21. Attribute workflag;
  22. Attribute enterable;
  23. Attribute scenery;
  24. Attribute static;
  25. Attribute direction;
  26. Attribute visited;
  27. Attribute lockable;
  28. Attribute locked;
  29. Attribute switchable;
  30. Attribute on;
  31. Attribute general;
  32. Attribute edible;
  33. Attribute autosearch;
  34. Attribute scored;
  35. Attribute talkable;
  36. Attribute is_cube;
  37.  
  38. Property longdesc 0;
  39. Property article "a";
  40. Property initpos 0;
  41.  
  42. Property preroutine $ffff;
  43. Property postroutine $ffff;
  44. Property rodroutine $ffff;
  45.  
  46. Property dirprop;
  47. Property n_to;  Property s_to;
  48. Property e_to;  Property w_to;
  49. Property ne_to; Property se_to;
  50. Property nw_to; Property sw_to;
  51. Property u_to;  Property d_to;
  52.  
  53. Property portalto;
  54. Property closedpos;
  55. Property long timeleft;
  56. Property with_key;
  57. Property becomes;
  58.  
  59. Object compass "compass" nothing has concealed;
  60. Object n_obj "north wall" compass      
  61.   with name "n" "north" "wall",           article "the", dirprop n_to   has  direction scenery;
  62. Object s_obj "south wall" compass      
  63.   with name "s" "south" "wall",           article "the", dirprop s_to   has  direction scenery;
  64. Object e_obj "east wall" compass      
  65.   with name "e" "east" "wall",            article "the", dirprop e_to   has  direction scenery;
  66. Object w_obj "west wall" compass       
  67.   with name "w" "west" "wall",            article "the", dirprop w_to   has  direction scenery;
  68. Object ne_obj "northeast wall" compass 
  69.   with name "ne" "northe" "wall",         article "the", dirprop ne_to  has  direction scenery;
  70. Object nw_obj "northwest wall" compass
  71.   with name "nw" "northw" "wall",         article "the", dirprop nw_to  has  direction scenery;
  72. Object se_obj "southeast wall" compass
  73.   with name "se" "southe" "wall",         article "the", dirprop se_to  has  direction scenery;
  74. Object sw_obj "southwest wall" compass
  75.   with name "sw" "southw" "wall",         article "the", dirprop sw_to  has  direction scenery;
  76. Object u_obj "ceiling" compass         
  77.   with name "u" "up" "ceiling",           article "the", dirprop u_to   has  direction scenery;
  78. Object d_obj "floor" compass
  79.   with name "d" "down" "floor",           article "the", dirprop d_to   has  direction scenery;
  80.  
  81.  
  82. Object thedark "Darkness" nothing
  83.   with longdesc "It is pitch dark, and you can't see a thing.";
  84.  
  85.  
  86. Object cave "Y2 Rock Room" nothing
  87.   with longdesc "You are in a large room, with a passage to the south, \
  88.                  a passage to the west, and a wall of broken rock to the \
  89.                  east.  There is a large ~Y2~ on a rock in the room's centre.",
  90.        w_to broken, s_to reservoir
  91.   has  light;
  92. Object rubble "rubble" cave
  93.   with name "rubble" "landslide" "rocks"
  94.   has  scenery;
  95. Object rock "Y2 rock" cave
  96.   with name "rock", article "the",
  97.        longdesc "The author of this demonstration has never, ever understood what the Y2 rock was \
  98.            for.  Was it a grid reference?  Or a question?"
  99.   has  scenery;
  100. Object cube1 "featureless white cube" cave
  101.   with name "white" "cube",
  102.        initpos "Sitting on top of the Y2 rock is a featureless white cube.",
  103.        preroutine Cube1Pre
  104.   has  is_cube scored;
  105. Object selfobj "yourself" cave
  106.   with name "me" "myself" "self", article "the"
  107.   has  concealed animate proper;
  108. Object sword "Elvish-made sword" selfobj
  109.   with name "elven" "elvish" "sword", article "an";
  110. Object cube2 "featureless white cube" selfobj
  111.   with name "white" "cube"
  112.   has  is_cube;
  113. Object lamp "brass lantern" selfobj
  114.   with name "brass" "lamp" "lantern"
  115.   has  light;
  116. Object car "little red car" cave
  117.   with name "little" "red" "car",
  118.        longdesc "Large enough to sit inside.  Among the controls is a prominent \
  119.                  on/off switch.  The numberplate is KAR 1.",
  120.        initpos "The red car sits here, its engine still running.",
  121.        closedpos "A little red car is parked here."
  122.   has  switchable enterable static container open;
  123. Object note "small note" car
  124.   with name "small" "note",
  125.        longdesc "  !!!! FROBOZZ MAGIC CAR COMPANY !!!!^\
  126.                  ^Hello, Driver!^\
  127.                  ^Instructions for use:^\
  128.                  ^Switch on the ignition and off you go!^\
  129.                  ^Warranty:^\
  130.                  ^This car is guaranteed against all defects for a period of 76 milliseconds \
  131.                  from date of purchase or until first used, whichever comes first.^\
  132.                  ^Good Luck!";
  133.  
  134. Object view "Window" nothing
  135. with longdesc "You're at a low window overlooking a huge pit, which \
  136.        extends up out of sight.  A floor is indistinctly visible \
  137.        over 50 feet below.  Traces of white mist cover the floor \
  138.        of the pit, becoming thicker to the right.  Marks in the \
  139.        dust around the window would seem to indicate that \
  140.        someone has been here recently.^^Directly across the pit \
  141.        from you and 25 feet away there is a similar window \
  142.        looking into a lighted room.  A shadowy figure can \
  143.        be seen there peering back at you.^^A narrow crack in the \
  144.        rocks leads back down.",
  145.      d_to broken
  146. has  light;
  147. Object key "iron key" view
  148.   with name "iron" "key", article "an";
  149.  
  150.  
  151. Object broken "Broken Passage" nothing
  152.   with longdesc "You are in a dirty broken passage.  To the east is a \
  153.            crawl.  To the south is a large passage.  Above you is another passage.",
  154.   e_to cave, n_to door, s_to yriver, u_to view;
  155. Object door "iron door" broken
  156.   with name "iron" "door",
  157.        initpos "In the north wall is an open iron door.",
  158.        closedpos "In the north wall is a shut iron door.",
  159.        portalto ledge,
  160.        dirprop n_to,
  161.        with_key key
  162.   has  portal static openable lockable locked;
  163. Object ledge "Canyon Ledge" nothing
  164.   with longdesc "The door opened out onto a tiny ledge at the top of the Great Canyon \
  165.            on its west wall. From here there \
  166.            is a marvelous view of the canyon and parts of the Frigid River upstream. \
  167.            Across the canyon, the walls of the White Cliffs join the mighty ramparts of the \
  168.            Flathead Mountains to the east. Following the Canyon upstream to the north, Aragain \
  169.            Falls may be seen, complete with rainbow. The mighty Frigid River flows out from a \
  170.            great dark cavern. To the west and south can be seen an immense forest, stretching \
  171.            for miles around. It is absolutely impossible to climb down into the \
  172.            canyon from here.",
  173.        s_to broken;
  174.  
  175.  
  176. Object yriver "Yellow River Rock" nothing
  177.   with longdesc "You are in a splendid chamber thirty feet high.  The walls \
  178.            are frozen rivers of orange stone.  An awkward canyon and a \
  179.            good passage exit from north and south sides of the chamber.",
  180.        n_to broken, s_to debris;
  181. Object sack "brown paper sack" yriver
  182.   with name "brown" "paper" "sack",
  183.        initpos "Hanging mysteriously in mid-air, at about the height of a \
  184.                 kitchen table, is an elongated brown sack, smelling of hot peppers."
  185.   has  container interior openable;
  186. Object cube3 "featureless white cube" sack
  187.   with name "white" "cube"
  188.   has  is_cube scored;
  189. Object clove "clove of garlic" sack
  190.   with name "clove" "of" "garlic"
  191.   has  edible;
  192. Object sandwich "pepper sandwich" sack
  193.   with name "pepper" "sandwich"
  194.   has  edible;
  195.  
  196.  
  197. Object debris "Debris" nothing
  198.   with longdesc "You are in a debris room filled with stuff washed in from the \
  199.            surface.  A low wide passage with cobbles becomes plugged \
  200.            with mud and debris here, but an awkward canyon leads \
  201.            north and steps lead up.  A note on the wall says:^\
  202.            ^    Magic Word ~XYZZY~",
  203.        n_to yriver, u_to mists;
  204. Object gun "ray gun" debris
  205.   with name "ray" "gun",
  206.        longdesc "Labelled Frobozz Magic Ray Gun Co., it works on gerontological principles."
  207.   has  scored;
  208.  
  209.  
  210. Object mists "Hall of Mists" nothing
  211.   with longdesc "You are at one end of a vast hall stretching forward out of \
  212.            sight to the west.  There are bricked-up openings to either side. \
  213.            Nearby, a wide stone staircase leads downward.  The hall \
  214.            is filled with wisps of white mist swaying to and fro \
  215.            almost as if alive.  A cold wind blows up the staircase. \
  216.            There is a passage at the top of a dome behind you.",
  217.        d_to debris, w_to wend,
  218.        preroutine MistsPre;
  219. Object snake "sullen snake" mists
  220.   with name "sullen" "snake",
  221.        longdesc "Perhaps a boa constrictor.  Perhaps not."
  222.   has  animate;
  223. Object oldsnake "aged, sullen snake" nothing
  224.   with name "sullen" "snake", article "an",
  225.        longdesc "A sad and decrepit echo of a once-great serpent."
  226.   has  animate;
  227.  
  228.  
  229. Object wend "West End of Hall of Mists" nothing
  230.   with longdesc "You are on the east bank of a fissure slicing clear across \
  231.            the hall.  The mist is quite thick here, and the fissure \
  232.            is too wide to jump.",
  233.        e_to mists
  234.   has  scored;
  235. Object grenade "hand grenade" wend
  236.   with name "hand" "grenade",
  237.        initpos "A dangerous-looking hand grenade rolls about on the floor here.",
  238.        timeleft 0,
  239.        preroutine GrenadePre;
  240.  
  241.  
  242. Object reservoir "Reservoir" nothing
  243.   with longdesc "You are at the edge of a large underground reservoir.  An \
  244.            opaque cloud of white mist fills the room and rises \
  245.            rapidly upward.  The lake is fed by a stream which tumbles \
  246.            out of a hole in the wall about 10 feet overhead and \
  247.            splashes noisily into the water somewhere within the mist. \
  248.            The only passages go north and east.",
  249.        n_to cave, e_to loud
  250.   has  scored;
  251. Object clover "two-leafed clover" reservoir
  252.   with name "two" "two-lea" "clover",
  253.        longdesc "Unlucky for some.",
  254.        initpos "Growing from a tuft of mould is a single two-leafed clover.",
  255.        postroutine CloverPost;
  256.  
  257.  
  258. Object loud "Loud Room" nothing
  259.   with longdesc "This is a large room with a ceiling which cannot be detected from the ground. \
  260.            There is a narrow passage leading west. \
  261.            The room is deafeningly loud with an undetermined rushing sound. The sound seems to \
  262.            reverberate from all of the walls, making it difficult even to think.",
  263.        w_to reservoir,
  264.        preroutine LoudPre;
  265. Object bar "platinum bar" loud
  266.   with name "bar" "platinum",
  267.        longdesc "Exquisite."
  268.   has  scored;
  269.  
  270.  
  271. Dictionary again_word   "again";
  272. Dictionary g_word       "g";
  273. Dictionary it_word      "it";
  274. Dictionary them_word    "them";
  275. Dictionary and_word     "and";
  276. Dictionary comma_word   "xcomma";
  277. Dictionary but_word     "but";
  278. Dictionary except_word  "except";
  279. Dictionary all_word     "all";
  280. Dictionary both_word    "both";
  281. Dictionary everyt_word  "everyt";
  282. Dictionary the_word     "the";
  283. Dictionary a_word       "a";
  284. Dictionary an_word      "an";
  285. Dictionary o_word       "o";
  286. Dictionary oops_word    "oops";
  287.  
  288. Dictionary cubes_word   "cubes";
  289.  
  290. Global location = cave;
  291. Global score = 0;
  292. Global turns = 1;
  293. Global player = selfobj;
  294.  
  295. Global itobj = 0;
  296. Global toomanyf = 0;
  297. Global actor = 0;
  298.  
  299. Global lightflag = 1;
  300. Global deadflag = 0;
  301.  
  302. Global buffer string 120;
  303. Global parse string 64;
  304. Global buffer2 string 120;
  305. Global parse2 string 64;
  306. Global inputobjs data 16;
  307. Global action = 0;
  308. Global inp1 = 0;
  309. Global inp2 = 0;
  310. Global multinps data 64;
  311. Global special_word = 0;
  312. Global special_number = 0;
  313.  
  314. Global scr_mode = 0;
  315.  
  316. ! ---------------------------------------------------------------------------------------------------
  317. ! Game control code
  318. ! ---------------------------------------------------------------------------------------------------
  319.  
  320.  
  321. [ Main;
  322.  
  323.   print "^^^^^What a horrid dream, all about compiling something.  Thank heavens \
  324.          you've finally woken up, even if you seem to have been sleep-walking.  \
  325.          As you dizzily shake your head, you can't help feeling this place is somehow \
  326.          familiar...^^";
  327.  
  328.   Banner();
  329.  
  330.   LookSub();
  331.   Game();
  332. ];
  333.  
  334. global multiflag;
  335.  
  336. [ Game unused i j k l meta aflag;
  337.  
  338.   for i 1 to 100 { j=random(i); }
  339.  
  340.   while deadflag==0
  341.   {   .Error; inp1=0; inp2=0; action=0;
  342.       Input(inputobjs);
  343.  
  344.       if actor~=player { CDefArt(actor); print " has better things to do.^"; jump timeslice; }
  345.  
  346.       if toomanyf==1
  347.       {   toomanyf=0;
  348.           print "(taking the first sixteen objects only)^";
  349.       }
  350.       aflag=0;
  351.       if action~=0 { aflag=1; }
  352.       if action==0 { action=inputobjs->0; }
  353.       meta=0;
  354.  
  355.       if action==#a$ScoreSub or #a$ScriptonSub or #a$ScriptoffSub { meta=1; }
  356.       if action==#a$SaveSub or #a$RestoreSub { meta=1; }
  357.  
  358.       if aflag==0
  359.       {   i=inputobjs->1;
  360.           inp1=inputobjs->2;
  361.           inp2=inputobjs->3;
  362.       }
  363.       if aflag~=0
  364.       {   i=2;
  365.       }
  366.       multiflag=0;
  367.       if i==0 { Process(0,0); }
  368.       if i>0
  369.       {   if inp1~=0 { Process(inp1,inp2); }
  370.           if inp1==0
  371.           {   multiflag=1;
  372.               j=multinps->0;
  373.               if j==0 { print "Nothing to do!^"; jump Error; }
  374.               for k 1 to j
  375.               {   l=multinps->k; print_obj l; print ": ";
  376.                   Process(l,inp2);
  377.               }
  378.           }
  379.       }
  380.       .timeslice;
  381.       if deadflag==0 { if meta==0 { Time(); } }
  382.   }
  383.   print "^^    ***";
  384.   if deadflag==1 { print " You have died "; }
  385.   if deadflag==2 { print " You have won "; }
  386.   print "***^^^";
  387.   ScoreSub();
  388.  
  389.   .RRQPL;
  390.   print "^Would you like to RESTART, RESTORE a saved game or QUIT?^";
  391.   .RRQL;
  392.   print_char '?'; print_char ' ';
  393.   read buffer parse;
  394.   i=parse-->1;
  395.   if i==#w$quit or #w$q { quit; }
  396.   if i==#w$restar { restart; }
  397.   if i==#w$restor { RestoreSub(); jump RRQPL; }
  398.   print "Please answer RESTART, RESTORE or QUIT.^";
  399.   jump RRQL;
  400. ];
  401.  
  402. [ Process i j;
  403.   inp1 = i; inp2 = j;
  404.   if location~=0
  405.   {   i=prop(location,preroutine);
  406.       if i~=$ffff
  407.       {   if indirect(i)~=0 { ret#true; }
  408.       }
  409.   }
  410.   if inp1~=0
  411.   {   i=prop(inp1,preroutine);
  412.       if i~=$ffff
  413.       {   if indirect(i)~=0 { ret#true; }
  414.       }
  415.   }
  416.   j=#actions_table-->action;
  417.   indirect(j);
  418. ];
  419.  
  420. [ PostAct i k;
  421.  
  422.   k=location; i=prop(k,postroutine);
  423.   if i==$ffff { jump NoLocPost; }
  424.   if indirect(i)~=0 { ret#true; }
  425.  
  426.   .NoLocPost;
  427.   k=0; i=inputobjs->1;
  428.   if i~=0 { k=inp1; }
  429.   if k==0 { ret#false; }
  430.   i=prop(k,postroutine);
  431.   if i==$ffff { ret#false; }
  432.   indirect(i);
  433.   return sp;
  434. ];
  435.  
  436. [ LPostAct i k;
  437.   k=location;
  438.   if k==0 { ret#false; }
  439.   i=prop(k,postroutine);
  440.   if i==$ffff { ret#false; }
  441.   indirect(i);
  442.   return sp;
  443. ];
  444.  
  445. [ Banner i;
  446.   print_paddr #Story;
  447.   print "^An Interactive Demonstration^\
  448.          Copyright (c) 1993 by Graham Nelson. All rights given away.^\
  449.          Release ";
  450.   print_num (0-->1) & $03ff;
  451.   print " / Serial number ";
  452.   for i 18 to 23
  453.   {   print_char 0->i;
  454.   }
  455.   print "  (Compiled by Inform v"; inversion; print ")^";
  456. ];
  457.  
  458. [ Time i j k;
  459.   inc turns;
  460.  
  461.   if random(4)==1
  462.   {   i=random(6);
  463.       if i==1 { print "^Far away, you hear the hammering of dwarven anvils.^"; }
  464.       if i==2 { print "^A shadowy figure glides by in the corner of view.^"; }
  465.       if i==3 { print "^Bats flutter through the cave, startling you.^"; }
  466.       if i==4 { print "^A hoarse voice whispers, ~PLUGH~.^"; }
  467.       if i==5 { print "^The floor shakes in a sudden earth tremor!^"; }
  468.       if i==6 { print "^You hear a door creak open, somewhere in the distance.^"; }
  469.   }
  470.  
  471.   if TimeUp(grenade)==1
  472.   {   print "^There is suddenly an immense explosion!  This is unlikely to teach you \
  473.               not to meddle with things you don't understand, but on the other hand you'll \
  474.               never do so again.^"; deadflag=1;
  475.   }
  476.   
  477.   i=lightflag;
  478.   lightflag=OffersLight(parent(player));
  479.  
  480.   if i==0
  481.   {   if lightflag==1 { new_line; location=parent(player); LookSub(1); }
  482.   }
  483.   if i==1
  484.   {   if lightflag==0 { new_line; print "It is now pitch dark in here!^"; location=thedark; }
  485.   }
  486. ];
  487.  
  488. [ TimeUp i j;
  489.   j=prop(i,timeleft);
  490.   if j>turns { ret#false; }
  491.   if j==0 { ret#false; }
  492.   put_prop i timeleft 0;
  493.   ret#true;
  494. ];
  495.  
  496. [ DecTimeUp i j;
  497.   j=prop(i,timeleft);
  498.   if j==0 { ret#false; }
  499.   dec j; put_prop i timeleft j;
  500.   if j>0 { ret#false; }
  501.   ret#true;
  502. ];
  503.  
  504. [ SetTimer i j;
  505.   j=turns+j;
  506.   put_prop i timeleft j;
  507. ];
  508.  
  509. [ Clock i j;
  510.   j=prop(i,timeleft)-turns;
  511.   return j;
  512. ];
  513.  
  514. [ OffersLight i;
  515.   if i has light { ret#true; }
  516.   if i has container
  517.   {   if i has interior
  518.       {   if i hasnt open { ret#false; }
  519.       }
  520.   }
  521.   i=child(i);
  522.   while i~=0
  523.   {   if 1==OffersLight(i) { ret#true; }
  524.       i=sibling(i);
  525.   }
  526.   ret#false;
  527. ];
  528.  
  529. ! ---------------------------------------------------------------------------------------------------
  530. ! Verb action routines
  531. ! ---------------------------------------------------------------------------------------------------
  532.  
  533. [ ScoreSub rsc;
  534.   if deadflag==0
  535.   {   print "You have so far scored ";
  536.   }
  537.   if deadflag > 0 { print "In that game you scored "; }
  538.   print_num score; print " out of a possible 50, in ";
  539.   print_num turns; print " turns, earning you the rank of ";
  540.  
  541.   rsc=score;
  542.  
  543.   if rsc >= 35 { print_ret "navigator."; }
  544.   if rsc >= 20 { print_ret "adventurer."; }
  545.   if rsc >= 5 { print_ret "explorer."; }
  546.   if rsc >= 1 { print_ret "tourist."; }
  547.   print_ret "somnambulist.";
  548. ];
  549.  
  550. [ QuitSub i;
  551.   print "Are you sure you want to quit? ";
  552.   .QSL; read buffer parse;
  553.   i=parse-->1;
  554.   if i==#w$yes or #w$y { quit; }
  555.   if i==#w$no or #w$n { ret#true; }
  556.   print "Please answer yes or no.";
  557.   print_char '>'; print_char ' ';
  558.   jump QSL;
  559. ];
  560.  
  561. [ QQuitSub; quit; ];
  562.  
  563. [ RestartSub i;
  564.   print "Are you sure you want to restart? ";
  565.   .RSL; read buffer parse;
  566.   i=parse-->1;
  567.   if i==#w$yes { restart; }
  568.   if i==#w$y   { restart; }
  569.   if i==#w$no  { ret#true; }
  570.   if i==#w$n   { ret#true; }
  571.   print "Please answer yes or no.";
  572.   print_char '>'; print_char ' ';
  573.   jump RSL;
  574. ];
  575.  
  576. [ RestoreSub;
  577.   restore Rmaybe;
  578.   print_ret "Failed.";
  579.   .RMaybe; print "Ok.^";
  580. ];
  581.  
  582. [ SaveSub;
  583.   save Smaybe;
  584.   print_ret "Failed.";
  585.   .Smaybe; print "Ok.^";
  586. ];
  587.  
  588. [ ScriptOnSub i;
  589.   if scr_mode==1 { print_ret "Transcripting is already on."; }
  590.   scr_mode=1;
  591.   i=(0-->8)|1;
  592.   put 0 word 8 i;
  593.   print "Start of a transcript of^";
  594.   Banner();
  595. ];
  596.  
  597. [ ScriptOffSub i;
  598.   if scr_mode==0 { print_ret "Transcripting is already off."; }
  599.   print "^End of transcript.^";
  600.   scr_mode=0;
  601.   i=(0-->8)&$fffe;
  602.   put 0 word 8 i;
  603. ];
  604.  
  605. [ InvSub i;
  606.   i=child(player);
  607.   if i==0
  608.   {   print_ret "You are carrying nothing."; }
  609.   print "You are carrying:^";
  610.   Inventory(player);
  611. ];
  612.  
  613. [ Inventory obj n o2 i;
  614.   o2=1;
  615.   if n~=0
  616.   {   for i 1 to n { print "  "; }
  617.       o2=DescribeObj(obj,0); new_line;
  618.   }
  619.   if o2==0 { ret#true; }
  620.  
  621.   o2=child(obj);
  622.   while o2~=0
  623.   {   Inventory(o2,n+1); o2=sibling(o2);
  624.   }
  625. ];
  626.  
  627. [ TakeSub i;
  628.   i=RTakeSub(location);
  629.   if i~=0  { ret#true; }
  630.   if 1==PostAct() { ret#true; }
  631.   print "Taken.^";
  632. ];
  633.  
  634. [ RTakeSub fromobj i j k;
  635.   if inp1==player
  636.   {   print_ret "As the bishop said to the actress."; }
  637.   if inp1 has animate
  638.   {   print "I don't suppose "; DefArt(inp1); print_ret " would care for that."; }
  639.   i=parent(inp1);
  640.   if i==player
  641.   {   print_ret "You already have that."; }
  642.   while i~=fromobj
  643.   {   if i hasnt container { print_ret "That isn't available."; }
  644.       if i hasnt open { print "Unfortunately the "; print_obj i; print_ret " isn't open."; }
  645.       i=parent(i);
  646.       if i==player { i=fromobj; }
  647.   }
  648.   if inp1 has scenery { print_ret "That's hardly portable."; }
  649.   if inp1 has static { print_ret "Fixed in place."; }
  650.   j=child(player); k=0; while j~=0 { if j hasnt worn { k=k+1; } j=sibling(j); }
  651.   if k>4
  652.   {   print_ret "You're carrying too many things already."; }
  653.   remove_obj inp1;
  654.   insert_obj inp1 player;
  655.   if inp1 hasnt moved
  656.   {   set_attr inp1 moved;
  657.       if inp1 has scored { score=score+4; }
  658.   }
  659.   ret#false;
  660. ];
  661.  
  662. [ DropSub i j k;
  663.   i=parent(inp1);
  664.   if i==location
  665.   {   print_ret "Already on the floor."; }
  666.   if i~=player
  667.   {   print_ret "You haven't got that."; }
  668.   if inp1 has worn
  669.   { print "(First taking it off)^"; clear_attr inp1 worn; }
  670.   remove_obj inp1;
  671.   i=parent(player);
  672.   insert_obj inp1 i;
  673.   if 1==PostAct() { ret#true; }
  674.   print "Dropped.^";
  675. ];
  676.  
  677. [ RemoveSub i;
  678.   i=parent(inp1);
  679.   if i hasnt open { print_ret "Alas, it is closed."; }
  680.   if i~=inp2 { print_ret "But it isn't there now."; }
  681.   if inp2 has worn { print_ret "You'll need to take it off first."; }
  682.   i=RTakeSub(inp2);
  683.   if i~=0  { ret#true; }
  684.   action=#a$TakeSub;
  685.   if 1==PostAct() { ret#true; }
  686.   action=#a$RemoveSub;
  687.   if 1==PostAct() { ret#true; }
  688.   print "Removed.^";
  689. ];
  690.  
  691. [ InsertSub i;
  692.   if inp2==d_obj  { action=#a$DropSub; Process(inp1,0); ret#false; }
  693.   i=parent(inp1);
  694.   if i~=player { print_ret "You need to be holding it before you can put it into something else."; }
  695.   if inp2 hasnt container { print_ret "That can't contain things."; }
  696.   if inp2 hasnt open { print_ret "Alas, it is closed."; }
  697.   if inp2 has worn { print_ret "You'll need to take it off first."; }
  698.   if inp1 has worn { print "(first taking it off)^"; clear_attr inp1 worn; }
  699.  
  700.   remove_obj inp1; insert_obj inp1 inp2;
  701.  
  702.   if 1==LPostAct() { ret#true; }
  703.   if multiflag==1 { print_ret "Done."; }
  704.   print "You put the "; print_obj inp1; print " into the "; print_obj inp2; print_ret ".";
  705. ];
  706.  
  707. [ TransferSub i a;
  708.   a=#a$InsertSub; if inp2==d_obj { a=#a$DropSub; }
  709.   i=parent(inp1);
  710.   if i~=player
  711.   {   while i~=0
  712.       {   if i hasnt open { print_ret "That isn't in your possession."; }
  713.           i=parent(i);
  714.           if i==player { jump Segue; }
  715.       }
  716.       print_ret "First pick that up.";
  717.   }
  718.   .Segue; remove_obj inp1; insert_obj inp1 player; action=a; Process(inp1,inp2); ret#false;
  719. ];
  720.  
  721. [ EmptySub;
  722.   inp2=d_obj;
  723.   EmptyTSub();
  724. ];
  725.  
  726. [ EmptyTSub i j;
  727.   if inp1 hasnt container { CDefArt(inp1); print_ret " can't contain things."; }
  728.   if inp1 hasnt open { CDefArt(inp1); print_ret " is closed."; }
  729.   if inp2~=d_obj
  730.   {   if inp2 hasnt container { CDefArt(inp2); print_ret " can't contain things."; }
  731.       if inp2 hasnt open { CDefArt(inp2); print_ret " is closed."; }
  732.   }
  733.   i=inp1; i=child(i);
  734.   if i==0 { DefArt(inp1); print_ret " is empty already."; }
  735.   while i~=0
  736.   {   j=sibling(i);
  737.       print_obj i; print ": ";
  738.       action=#a$TransferSub; Process(i,inp2);
  739.       i=j;
  740.   }
  741. ];
  742.  
  743. [ EnterSub i;
  744.   if inp1 has portal { GoSub(); ret#true; } 
  745.   i=parent(player);
  746.   if i~=location { print "But you're already in the "; print_obj i; print_ret "."; }
  747.   if inp1 hasnt enterable { print_ret "A surreal idea."; }
  748.   i=parent(inp1);
  749.   if i==compass { GoSub(); ret#true; }
  750.   if i~=location { print_ret "You can only get into something on the floor."; }
  751.   remove_obj player;
  752.   insert_obj player inp1;
  753.   print "You get into the "; print_obj inp1; print_ret ".";
  754. ];
  755.  
  756. [ ExitSub i;
  757.   i=parent(player);
  758.   if i==location { print_ret "But you're aren't in anything at the moment."; }
  759.   remove_obj player;
  760.   insert_obj player location;
  761.   print "You are on your own two feet again.^"; LookSub(1); ret#true;
  762. ];
  763.  
  764. [ VagueGoSub;
  765.   print_ret "You'll have to say which compass direction to go in.";
  766. ];
  767.  
  768. [ GoSub i j k df movewith;
  769.  
  770.   movewith=0;
  771.   i=parent(player);
  772.   if location~=thedark
  773.   {   if i==car
  774.       {   if car has on
  775.           {   movewith=car; i=car; i=parent(i);
  776.               jump gotroom;
  777.           }
  778.           print_ret "The ignition isn't on at the moment.";
  779.       }
  780.       if i~=location { print "You'll have to get out of the "; print_obj i; print_ret " first."; }
  781.   }
  782.   .gotroom;
  783.   j=prop(i, prop(inp1, dirprop));
  784.   if j==0
  785.   {   print_ret "You can't go that way.";
  786.   }
  787.   if j has portal
  788.   {   if j has concealed { print_ret "You can't go that way."; }
  789.       if j hasnt open
  790.       {   if inp1==u_obj { print "You are unable to climb "; Defart(j); print_ret "."; }
  791.           if inp1==d_obj { print "You are unable to descend "; Defart(j); print_ret "."; }
  792.           print "You can't, since "; Defart(j); print_ret " is in the way.";
  793.       }
  794.       j=prop(j,portalto);
  795.       if j==0 { print "You can't, since "; Defart(j); print_ret " leads nowhere."; }
  796.   }
  797.   if movewith==0  {  remove_obj player; insert_obj player j;  }
  798.   if movewith~=0
  799.   {   if inp1==d_obj or u_obj { print_ret "It won't go that way."; }
  800.       remove_obj movewith; insert_obj movewith j;
  801.   }
  802.  
  803.   df=OffersLight(j);
  804.  
  805.   if df~=0 { location=j; lightflag=1; }
  806.   if df==0
  807.   {   if location==thedark
  808.       {   deadflag=1;
  809.           print_ret "As you step falteringly through the darkness, cowardly but \
  810.                  evil creatures devour you whole!";
  811.       }
  812.       location=thedark; lightflag=0;
  813.   }
  814.  
  815.   if 1==LPostAct() { ret#true; }
  816.  
  817.   LookSub(1);
  818. ];
  819.  
  820. [ LookSub weary i j k o flag descin;
  821.   descin=location;
  822.   new_line; print_obj location; i=parent(player);
  823.   if location~=thedark
  824.   {   if i~=location { print " (in the "; print_obj i; print ")"; descin=i; }
  825.   }
  826.   new_line;
  827.  
  828.   if location has visited
  829.   {   if weary==1 { jump NoLD; }
  830.   }
  831.   i = prop(location,longdesc);
  832.   print_paddr i; new_line;
  833.   .NoLD;
  834.  
  835.   if location hasnt visited
  836.   {   set_attr location visited;
  837.       if location has scored
  838.       {   score=score+5;
  839.       }
  840.   }
  841.   o=child(descin); k=0;
  842.   while o~=0
  843.   {   if o hasnt concealed
  844.       {  if o hasnt scenery
  845.          {   set_attr o workflag; inc k;
  846.              if o hasnt moved
  847.              {   j=prop(o,initpos);
  848.                  if o has portal
  849.                  {   if o hasnt open { j=prop(o,closedpos); }
  850.                  }
  851.                  if o has switchable
  852.                  {   if o hasnt on { j=prop(o,closedpos); }
  853.                  }
  854.                  if j~=0
  855.                  {   new_line;
  856.                      print_paddr j; new_line; flag=1;
  857.                      clear_attr o workflag; dec k;
  858.                  }
  859.              }
  860.          }
  861.       }
  862.       o=sibling(o);
  863.   }
  864.  
  865.   if k==0 { jump AskRoom; }
  866.   new_line;
  867.   if descin~=location { print "In the "; print_obj descin; print " you"; }
  868.   if descin==location { print "You"; }
  869.   print " can ";
  870.   if flag==1 { print "also "; }
  871.   print "see "; i=0;
  872.   o=child(descin);
  873.   while o~=0 { 
  874.    if o has workflag
  875.    {  i=i+1;
  876.       DescribeObj(o,1);
  877.       if i==k-1 { print " and "; }
  878.       if i < k-1 { print ", "; }
  879.    }
  880.    o=sibling(o);
  881.   }
  882.   if descin~=location { print ".^"; }
  883.   if descin==location { print " here.^"; }
  884.  
  885.   .AskRoom;
  886.   clear_attr sword light;
  887.   if location==parent(snake)
  888.   {   if player==parent(sword)
  889.       {   print "^Your sword gives off a bright greenish light!^"; set_attr sword light; }
  890.   }
  891.  
  892.   action=#a$LookSub;
  893.   if 1==LPostAct() { ret#true; }
  894. ];
  895.  
  896. [ ExamineSub i;
  897.   if location==thedark { print_ret "Darkness, noun.  An absence of light to see by."; }
  898.  
  899.   if inp1==selfobj { print_ret "As good-looking as ever."; }
  900.   if inp1 has autosearch { SearchSub(); ret#false; }
  901.   i=prop(inp1,longdesc);
  902.   if i==0
  903.   {   if inp1 has container { SearchSub(); ret#false; }
  904.       print "You see nothing special about "; Defart(inp1); print_ret ".";
  905.   }
  906.   print_paddr i; new_line;
  907.   if inp1 has switchable
  908.   {   print "It is currently switched ";
  909.       if inp1 has on { print "on.^"; }
  910.       if inp1 hasnt on { print "off.^"; }
  911.   }
  912.   if 1==PostAct() { ret#true; }
  913. ];
  914.  
  915. [ DescribeObj o listmode p p2 i k rval;
  916.  
  917.   if listmode ~=2 { Indefart(o); }
  918.   if listmode ==2 { Defart(o); }
  919.  
  920.   if o has light { print " (providing light)"; }
  921.   if o has worn { print " (being worn)"; }
  922.   if o has container
  923.   {   if listmode ~=2 { print " (which is "; }
  924.       if listmode ==2 { print ", which is "; }
  925.       if o hasnt open
  926.       { print "closed";
  927.         if o has interior { jump Cdone; }
  928.       }
  929.       if o has open { print "open"; }
  930.       p=child(o);
  931.       if p==0
  932.       {   print " but empty";
  933.           jump Cdone;
  934.       }
  935.       if listmode==0 { rval=1; jump Cdone; }
  936.       print " and contains ";
  937.       k=0; p2=p; while p2~=0 { p2=sibling(p2); inc k; }
  938.  
  939.       i=0; while p~=0 { inc i; DescribeObj(p,1);
  940.         if i==k-1 { print " and "; }
  941.         if i < k-1 { print ", "; }
  942.         p=sibling(p);
  943.       }
  944.       .Cdone;
  945.       if listmode ~=2 { print ")"; }
  946.   }
  947.   return rval;
  948. ];
  949.  
  950. [ GiveSub i j;
  951.   if inp2==snake
  952.   {   if inp1 has edible { remove_obj inp1; print_ret "~Mmm!  Thanks!  I still hate you, though.~"; }
  953.       print_ret "~Bleurghh!  Are you trying to poison me?~";
  954.   }
  955.   print_obj inp2; print_ret " doesn't seem interested.^";
  956. ];
  957.  
  958. [ UnlockSub i;
  959.   if inp1 hasnt lockable { print_ret "I can't see how to unlock that."; }
  960.   if inp1 hasnt locked { print_ret "It is in fact unlocked now."; }
  961.   i=prop(inp1,with_key);
  962.   if i~=inp2 { print_ret "That doesn't seem to fit the lock."; }
  963.   clear_attr inp1 locked;
  964.   if 1==PostAct() { ret#true; }
  965.   print "You unlock the "; print_obj(inp1); print ".^";
  966. ];
  967.  
  968. [ LockSub i;
  969.   if inp1 hasnt lockable { print_ret "I can't see how to lock that."; }
  970.   if inp1 has locked { print_ret "It is in fact locked now."; }
  971.   if inp1 has open { print_ret "First you'll have to close it."; }
  972.   i=prop(inp1,with_key);
  973.   if i~=inp2 { print_ret "That doesn't seem to fit the lock."; }
  974.   set_attr inp1 locked;
  975.   if 1==PostAct() { ret#true; }
  976.   print "You lock the "; print_obj(inp1); print ".^";
  977. ];
  978.  
  979. [ SwitchonSub;
  980.   if inp1 hasnt switchable { print_ret "That's not something you can switch."; }
  981.   if inp1 has on { print_ret "It's already on."; }
  982.   set_attr inp1 on;
  983.   if 1==PostAct() { ret#true; }
  984.   print "You switch the "; print_obj(inp1); print " on.^";
  985. ];
  986.  
  987. [ SwitchoffSub;
  988.   if inp1 hasnt switchable { print_ret "That's not something you can switch."; }
  989.   if inp1 hasnt on { print_ret "It's already off."; }
  990.   clear_attr inp1 on;
  991.   if 1==PostAct() { ret#true; }
  992.   print "You switch the "; print_obj(inp1); print " off.^";
  993. ];
  994.  
  995. [ OpenSub;
  996.   if inp1 hasnt openable { print_ret "That's not something you can open."; }
  997.   if inp1 has locked { print_ret "It seems to be locked."; }
  998.   if inp1 has open { print_ret "It's already open."; }
  999.   set_attr inp1 open;
  1000.   if 1==PostAct() { ret#true; }
  1001.   print "You open the "; print_obj(inp1); print ".^";
  1002. ];
  1003.  
  1004. [ CloseSub;
  1005.   if inp1 hasnt openable { print_ret "That's not something you can close."; }
  1006.   if inp1 hasnt open { print_ret "It's already closed."; }
  1007.   clear_attr inp1 open;
  1008.   if 1==PostAct() { ret#true; }
  1009.   print "You close the "; print_obj(inp1); print ".^";
  1010. ];
  1011.  
  1012. [ DisrobeSub;
  1013.   if inp1 hasnt worn { print_ret "You're not wearing that."; }
  1014.   clear_attr inp1 worn;
  1015.   print "You take off the "; print_obj(inp1); print ".^";
  1016. ];
  1017.  
  1018. [ WearSub i;
  1019.   if inp1 hasnt clothing { print_ret "You can't wear that!"; }
  1020.   i=parent(inp1);
  1021.   if i~=player { print_ret "You're not holding that!"; }
  1022.   set_attr inp1 worn;
  1023.   if 1==PostAct() { ret#true; }
  1024.   print "You put on the "; print_obj(inp1); print ".^";
  1025. ];
  1026.  
  1027. [ RhetSub;
  1028.   print_ret "That was a rhetorical question.";
  1029. ];
  1030.  
  1031. [ MagicWordSub;
  1032.   print_ret "For a moment you can almost hear a hoarse voice say something to you.  But it passes.";
  1033. ];
  1034.  
  1035. [ BurnSub;
  1036.   print_ret "In this game, arson is (usually) forbidden.";
  1037. ];
  1038.  
  1039. [ PraySub;
  1040.   print_ret "Spooky!  For a moment there, a deep voice seemed to say ~you're on your own~.";
  1041. ];
  1042.  
  1043. [ WakeSub;
  1044.   print_ret "The dreadful truth is, this is not a dream.";
  1045. ];
  1046.  
  1047. [ WakeOSub;
  1048.   print_ret "That seems unnecessary.";
  1049. ];
  1050.  
  1051. [ KissSub;
  1052.   print_ret "Keep your mind on the game.";
  1053. ];
  1054.  
  1055. [ ThinkSub;
  1056.   print_ret "Worth a try, anyway.  Why don't you?";
  1057. ];
  1058.  
  1059. [ SmellSub;
  1060.   if inp1==clove { print_ret "That'll keep the vampires away."; }
  1061.   if inp1==sandwich { print_ret "Peppers!  Excellent."; }
  1062.   if inp1==sack { print_ret "A tantalising aroma."; }
  1063.   print_ret "You smell nothing unexpected.";
  1064. ];
  1065.  
  1066. [ ListenSub;
  1067.   print_ret "You hear nothing unexpected.";
  1068. ];
  1069.  
  1070. [ TasteSub;
  1071.   print_ret "You taste nothing unexpected.";
  1072. ];
  1073.  
  1074. [ TouchSub;
  1075.   print_ret "You feel nothing unexpected.";
  1076. ];
  1077.  
  1078. [ TouchTSub;
  1079.   if inp1 has animate { print_ret "Keep your hands to yourself!"; }
  1080.   print_ret "You feel nothing unexpected.";
  1081. ];
  1082.  
  1083. [ DigSub;
  1084.   print_ret "The ground is unsuitable for digging here.";
  1085. ];
  1086.  
  1087. [ CutSub;
  1088.   print_ret "In this game, cutting things up is never helpful.";
  1089. ];
  1090.  
  1091. [ JumpsSub;
  1092.   print_ret "You jump on the spot, fruitlessly.";
  1093. ];
  1094.  
  1095. [ JumpSub;
  1096.   print_ret "In this game, it is never useful to jump over things.";
  1097. ];
  1098.  
  1099. [ TieSub;
  1100.   print_ret "In this game, it is never useful to tie things.";
  1101. ];
  1102.  
  1103. [ DrinkSub;
  1104.   if location==reservoir { print_ret "Unfluoridated and clear."; }
  1105.   print_ret "There's nothing suitable to drink here.";
  1106. ];
  1107.  
  1108. [ FillSub;
  1109.   print_ret "But there's no water here to carry.";
  1110. ];
  1111.  
  1112. [ SorrySub;
  1113.   print_ret "Oh, don't apologise.";
  1114. ];
  1115.  
  1116. [ StrongSub i;
  1117.   print_ret "Disgraceful!  Once upon a time adventurers had moral standards.";
  1118. ];
  1119.  
  1120. [ MildSub;
  1121.   print_ret "Quite.";
  1122. ];
  1123.  
  1124. [ AttackSub;
  1125.   if inp1==snake
  1126.   {   print_ret "Lazily, the snake dodges your attack."; }
  1127.   print_ret "Violence isn't the answer, you know.";
  1128. ];
  1129.  
  1130. [ SwimSub;
  1131.   if location==reservoir { deadflag=1;
  1132.       print_ret "Your first reaction is, this is very cold water.  Your \
  1133.       second reaction is that it is also very inhabited water.  What with the sea-serpent dragging \
  1134.       you down to a rapid drowning (it gurgles ~that's for the white crystal ball, you greedy swine~, \
  1135.       perhaps mistaking you for someone else) there is no opportunity for a third opinion."; }
  1136.   print_ret "There's not enough water to swim in.";
  1137. ];
  1138.  
  1139. [ SwingSub;
  1140.   print_ret "There's nothing sensible to swing here.";
  1141. ];
  1142.  
  1143. [ BlowSub;
  1144.   print_ret "You can't usefully blow that.";
  1145. ];
  1146.  
  1147. [ RubSub;
  1148.   print_ret "You achieve nothing by this.";
  1149. ];
  1150.  
  1151. [ SetSub i j;
  1152.   print_ret "No, you can't set that.";
  1153. ];
  1154.  
  1155. [ EatSub;
  1156.   if inp1 hasnt edible { print_ret "No, it's plainly inedible."; }
  1157.   print "You eat the "; print_obj inp1; print_ret ".  Not bad.";
  1158. ];
  1159.  
  1160. [ WaveNSub;
  1161.   if location==view
  1162.   {   print_ret "The shabby figure waves back at you."; }
  1163.   print_ret "You wave, feeling foolish.";
  1164. ];
  1165.  
  1166. [ WaveSub i;
  1167.   i=parent(inp1);
  1168.   if i~=player { print_ret "But you aren't holding it."; }
  1169.   print "You look ridiculous waving the "; print_obj inp1;
  1170.   print_ret ".";
  1171. ];
  1172.  
  1173. [ PullSub i j;
  1174.   if inp1 has static { print_ret "It is fixed in place."; }
  1175.   if inp1 has scenery { print_ret "You are unable to."; }
  1176.   print_ret "Nothing obvious happens.";
  1177. ];
  1178.  
  1179. [ PushSub i;
  1180.   if inp1 has static { print_ret "It is fixed in place."; }
  1181.   if inp1 has scenery { print_ret "You are unable to."; }
  1182.   print_ret "Nothing obvious happens.";
  1183. ];
  1184.  
  1185. [ PushDirSub i;
  1186.   i=parent(inp2);
  1187.   if i~=compass { print_ret "That's not a direction."; }
  1188.   if inp2==u_obj or d_obj { print_ret "Not that way you can't."; }
  1189.   if inp1~=car { print_ret "Is that the best you can think of?"; }
  1190.  
  1191.   print "The car rolls very slowly as you push it.^";
  1192.   i=inp1;
  1193.   inp1=inp2;
  1194.   GoSub();
  1195.   remove_obj i;
  1196.   insert_obj i location;
  1197. ];
  1198.  
  1199. [ TurnSub;
  1200.   if inp1 has static { print_ret "It is fixed in place."; }
  1201.   if inp1 has scenery { print_ret "You are unable to."; }
  1202.   print_ret "Nothing obvious happens.";
  1203. ];
  1204.  
  1205. [ SqueezeSub i;
  1206.   if inp1 has animate { print_ret "Keep your hands to yourself."; }
  1207.   print_ret "You achieve nothing by this.";
  1208. ];
  1209.  
  1210. [ LookUnderSub i;
  1211.   print_ret "You find nothing of interest.";
  1212. ];
  1213.  
  1214. [ SearchSub i j;
  1215.   if inp1 hasnt container
  1216.   {   print_ret "You find nothing of interest."; }
  1217.   if inp1 has interior
  1218.   {   if inp1 hasnt open
  1219.       {   print_ret "You can't see inside, since it is closed."; }
  1220.   }
  1221.   if 1==PostAct() { ret#true; }
  1222.   print "You peer at ";
  1223.   DescribeObj(inp1,2); print_ret ".";
  1224. ];
  1225.  
  1226. [ Indefart o;
  1227.   if o hasnt proper { print_paddr prop(o,article); print " "; }
  1228.   print_obj(o);
  1229. ];
  1230.  
  1231. [ Defart o;
  1232.   if o hasnt proper { print "the "; }
  1233.   print_obj(o);
  1234. ];
  1235.  
  1236. [ CDefart o;
  1237.   if o hasnt proper { print "The "; }
  1238.   print_obj(o);
  1239. ];
  1240.  
  1241. [ ThrowAtSub i j;
  1242.   if inp2 hasnt animate { print_ret "Futile."; }
  1243.   print_ret "You lack the nerve when it comes to the crucial moment.";
  1244. ];
  1245.  
  1246. [ AnswerSub i j c;
  1247.   print_ret "No reply.";
  1248. ];  
  1249.  
  1250. [ BuySub i;
  1251.   print_ret "Nothing is on sale.";
  1252. ];
  1253.  
  1254. [ AskSub;
  1255.   print_ret "No reply.";
  1256. ];  
  1257.  
  1258. [ SingSub;
  1259.   if random(2)==1 { print "Your yodelling "; }
  1260.   else { print "Your singing "; }
  1261.   print_ret "is atrocious, if you say so yourself.";
  1262. ];
  1263.  
  1264. [ ClimbSub;
  1265.   print_ret "I don't think much is to be achieved by that.";
  1266. ];  
  1267.  
  1268. [ WaitSub;
  1269.   print_ret "Time passes.";
  1270. ];  
  1271.  
  1272. [ EchoSub;
  1273.   if location==loud
  1274.   {   set_attr loud general;
  1275.       print_ret "The acoustics of the room subtly alter...";
  1276.   }
  1277.   print_ret "There isn't an echo here.";
  1278. ];  
  1279.  
  1280. [ ShootSub i;
  1281.   if player~=parent(gun)
  1282.   {   print_ret "You have nothing to shoot with.";
  1283.   }
  1284.   if inp1==gun { print_ret "It is unable to shoot itself."; }
  1285.   if inp1==selfobj { deadflag=1; print_ret "Your hands suddenly look rather white and skeletal, \
  1286.                          but then again the light is getting dimmer, and dear oh dear but it seems \
  1287.                          cold in here, and so sleepy..."; }
  1288.   if inp1 has edible { remove_obj inp1; print "Zap!  "; CDefArt(inp1);
  1289.                        print_ret " decays into a noisome mess and expires messily into dust."; }
  1290.   if inp1==clover { remove_obj clover; print_ret "Zap!  The clover shrivels into dust."; }
  1291.   if inp1==snake { remove_obj snake; insert_obj oldsnake mists;
  1292.                    print_ret "Zap!  The snake suddenly wrinkles and concertinas, sheds a layer of skin \
  1293.                               and lurches back upright, looking sadly decrepit."; }
  1294.   if inp1==oldsnake { remove_obj oldsnake; deadflag=1;
  1295.                    print_ret "Zap!  The old snake dodges your callous blast, leaps forward and sinks its \
  1296.                               aged fangs into your wrist.  Amazing how the venom is still effective \
  1297.                               even at that age, isn't it?"; }
  1298.   print_ret "Zap!  There is no appreciable effect.";
  1299. ];  
  1300.  
  1301. [ SleepSub i j;
  1302.   print_ret "You must have slept yourself out.  You certainly aren't drowsy now.";
  1303. ];
  1304.  
  1305. [ CloverPost;
  1306.   if action~=#a$TakeSub { ret#false; }
  1307.   if player~=parent(sword) { ret#false; }
  1308.   print_ret "As you take the clover, your sword shines a sudden burst of light!";
  1309. ];
  1310.  
  1311. [ Cube1Pre;
  1312.   if action~=#a$TakeSub { ret#false; }
  1313.   print_ret "You flinch from touching the cube, which is white hot!";
  1314. ];
  1315.  
  1316. [ LoudPre i;
  1317.   if loud has general { ret#false; }
  1318.   if action==#a$GoSub { ret#false; }
  1319.   i=parse-->1;
  1320.   print_addr i; print_char ' '; print_addr i; print_char ' '; print_addr i; print "...^";
  1321.   if action==#a$EchoSub { ret#false; }
  1322.   ret#true;
  1323. ];
  1324.  
  1325. [ MistsPre i;
  1326.   if action~=#a$GoSub { ret#false; }
  1327.   if inp1~=w_obj { ret#false; }
  1328.   if mists==parent(snake) { print_ret "The snake, predictably, won't let you pass."; }
  1329.   print "You dodge the sad old snake without difficulty.^";
  1330.   ret#false;
  1331. ];
  1332.  
  1333. [ GrenadePre;
  1334.   if action~=#a$PullSub { ret#false; }
  1335.   if grenade has general { ret#false; }
  1336.   SetTimer(grenade, 5); set_attr grenade general;
  1337.   print_ret "You pull the pin out, an irrevocable act.";
  1338. ];
  1339.  
  1340. ! ---------------------------------------------------------------------------------------------------
  1341. ! The Z-code part of the parser
  1342. ! ---------------------------------------------------------------------------------------------------
  1343.  
  1344. global wn;
  1345. global nwords;
  1346. global mmode;
  1347. global mfilter;
  1348. global allmode;
  1349. global verbn;
  1350. global pstack data 16;
  1351. global pspare data 16;
  1352. global pcount;
  1353. global pcounts;
  1354. global inferfrom;
  1355. global inferword;
  1356. global oops_from = 0;
  1357. global e_oops = 0;
  1358. global oops_heap data 16;
  1359.  
  1360. global matchlist data 64;
  1361. global match_p;
  1362. global match_t;
  1363. global match_w;
  1364. global indef_mode;
  1365. global wnbase;
  1366.  
  1367. [ Keyboard b p nw i w x1 x2;
  1368.     .KAgain;
  1369.     for i 0 to 9 { put oops_heap byte i p->i; }
  1370.     new_line; print_char '>'; read b p;
  1371.     .KKAgain;
  1372.     nw=p->1; w=p-->1;
  1373.     if nw == 0
  1374.     { print "I beg your pardon?^"; jump KAgain; }
  1375.     if w == oops_word { jump dooops; }
  1376.     if w ~= o_word { return nw; }
  1377.     .dooops;
  1378.     if oops_from == 0 { print "Sorry, that can't be corrected.^"; jump KAgain; }
  1379.     if nw == 1 { print "Think nothing of it.^"; jump KAgain; }
  1380.     if nw > 2 { print "~Oops~ can only correct a single word.^"; jump KAgain; }
  1381.     x1=p-->3; x2=p-->4;
  1382.     for i 0 to 9 { put p byte i oops_heap->i; }
  1383.     w=2*oops_from - 1;
  1384.     put p word w x1;
  1385.     inc w;
  1386.     put p word w x1;
  1387.     return nw;
  1388. ];
  1389.  
  1390. [ Input ibuff parset cl clines pline i j k l m o etype amode allwn allk;
  1391.     
  1392.   .Retry;
  1393.  
  1394.     Keyboard(buffer,parse);
  1395.  
  1396.   .Retrynotk;
  1397.     nwords=parse->1;
  1398.     etype=1;
  1399.     wnbase=1;
  1400.     actor=player;
  1401.   .BeginComm;
  1402.     wn=wnbase;
  1403.     verbn = NextWord();
  1404.     if verbn==g_word { verbn=again_word; }
  1405.     if verbn==again_word { ret#true; }
  1406.     if verbn==0
  1407.     {   etype=11; jump GiveError;
  1408.     }
  1409.     i=(verbn->4) & 1;
  1410.     if i==0
  1411.     {   wn=wnbase;
  1412.         l=NounDomain(compass,0,0);
  1413.         if l==1000 { jump Retrynotk; }
  1414.         if l~=0 
  1415.         {   put ibuff byte 1 1;
  1416.             put ibuff byte 0 #a$GoSub;
  1417.             put ibuff byte 2 l;
  1418.             ret#true;
  1419.         }
  1420.         if actor==player
  1421.         {   for j 2 to nwords
  1422.             {   i=NextWord(); if i==comma_word { jump Converse; }
  1423.             }
  1424.         }
  1425.         etype=11; jump GiveError;
  1426.         .Converse;
  1427.         j=wn-1; k=6;
  1428.         if j==1 { print "You can't begin with a comma.^"; jump Retry; }
  1429.         wn=1;
  1430.         l=NounDomain(player,location,k);
  1431.         if l==1000 { jump RetryNotK; }
  1432.         if l==0 { print "You seem to want to talk to someone, but I can't see whom.^"; jump Retry; }
  1433.         if l has talkable { jump CTAA; }
  1434.         if l hasnt animate { print "You can't talk to "; DefArt(l); print ".^"; jump Retry; }
  1435.         .CTAA;
  1436.         if wn~=j { print "To talk to someone, try ~someone, hello~ or some such.^"; jump Retry; }
  1437.         wnbase=j+1; actor=l;
  1438.         jump BeginComm;
  1439.     }
  1440.  
  1441.     i=$ff-(verbn->5);
  1442.     parset=(0-->7)-->i;
  1443.     clines=(parset->0)-1;
  1444.  
  1445.     for cl 0 to clines;
  1446.     {   wn=wnbase+1;
  1447.         pline=parset+1+cl*8; inferfrom=0;
  1448.         j=0; allmode=0;
  1449.         for pcount 1 to 6;
  1450.         {   put pstack word pcount 0;
  1451.             k=pline->pcount;
  1452.             if k>7
  1453.             {   put pstack word pcount 1000+k;
  1454.                 if wn > nwords
  1455.                 {   if inferfrom==0
  1456.                     {   if j< pline->0 { inferfrom=pcount; inferword=k; }
  1457.                     }
  1458.                     if inferfrom==0 { break; }
  1459.                 }
  1460.                 if wn <= nwords
  1461.                 {   if k~=Adjective(parse) { break; } }
  1462.                 jump Back;
  1463.             }
  1464.             if j == pline->0
  1465.             {  
  1466.            
  1467.                 if wn < nwords+1
  1468.                 {   for m 0 to 7 { put pspare word m pstack-->m; }
  1469.                     pcounts=pcount;
  1470.                     etype=2; break; }
  1471.                 if allmode==1 { wn=allwn; k=allk; jump OList; }
  1472.                 .AllDone;
  1473.                 put ibuff byte 1 pline->0;
  1474.                 put ibuff byte 0 pline->7;
  1475.                 if j > 0 { itobj=ibuff->2; }
  1476.                 oops_from = 0;
  1477.                 ret#true;
  1478.             }
  1479.  
  1480.             mmode=0; amode=0;
  1481.  
  1482.             .OList;
  1483.             o=NextWord(); dec wn;
  1484.             if o==it_word  { if itobj==0 { etype=8; break; }   }    
  1485.             if o==them_word  { if itobj==0 { etype=8; break; }   }    
  1486.  
  1487.             indef_mode=0;
  1488.             if o==the_word { inc wn; jump OList; }
  1489.             if o==a_word { inc wn; indef_mode=1; }
  1490.             if o==an_word { inc wn; indef_mode=1; }
  1491.  
  1492.             if k==7
  1493.             {   special_number=TryNumber(wn);
  1494.                 special_word=NextWord();
  1495.                 put ibuff byte j+2 $ff;
  1496.                 j=j+1;
  1497.                 put pstack word pcount $ff;
  1498.                 jump KeepGoing;
  1499.             }
  1500.  
  1501.             mfilter=0;
  1502.             if o==cubes_word { o=all_word; mfilter=is_cube; }
  1503.             
  1504.             if o==everyt_word { o=all_word; }
  1505.             if o==both_word { o=all_word; }
  1506.             if o==all_word
  1507.             {   if k<2 { etype=6; break; }
  1508.                 if k>=6 { etype=6; break; }
  1509.                 inc allmode;
  1510.                 if allmode>2 { etype=7; break; }
  1511.                 if allmode==2
  1512.                 {   if k==5 { DoAll(ibuff->3); }
  1513.                     if k==4 { DoAll(actor); o=parent(ibuff->3);
  1514.                               if o==actor { MultiSub(ibuff->3); }
  1515.                             }
  1516.                     if k==2 { DoAll(location); }
  1517.                     if k==3 { DoAll(actor); }
  1518.                     if mfilter~=0 { MultiFilter(mfilter); }
  1519.                 }
  1520.                 if allmode==1
  1521.                 {   allwn=wn; allk=k; DoAll(location);
  1522.                 }
  1523.                 inc wn;
  1524.                 jump Exceptions;
  1525.             }
  1526.  
  1527.             oops_from=wn;
  1528.  
  1529.             if k~=1
  1530.             {   l=NounDomain(location, actor, k);
  1531.                 if l==1000 { jump Retrynotk; }
  1532.                 if l==0 { etype=3; e_oops=oops_from; break; }
  1533.                 if k==6
  1534.                 {   if l hasnt animate
  1535.                     {   etype=10; break; }
  1536.                 }
  1537.                 if amode==0
  1538.                 {   put ibuff byte j+2 l;
  1539.                     j=j+1;
  1540.                     put pstack word pcount l;
  1541.                 }
  1542.                 if amode==1
  1543.                 {   MultiAdd(l); }
  1544.                 if amode==2
  1545.                 {   m=MultiSub(l); if allmode~=1 { if m~=0 { etype=m; break; } } }
  1546.             }
  1547.             if k==1
  1548.             {   l=NounDomain(actor,location,k);
  1549.                 if l==1000 { jump Retrynotk; }
  1550.                 if l==0 { etype=3; e_oops=oops_from; break; }
  1551.                 o=parent(l);
  1552.                 if o~=actor { etype=5; e_oops=oops_from; break; }
  1553.                 put ibuff byte j+2 l;
  1554.                 j=j+1;
  1555.                 put pstack word pcount l;
  1556.             }
  1557.  
  1558.             .KeepGoing;
  1559.             o=NextWord();
  1560.             if 0~=Refers(l,o) { jump KeepGoing; }
  1561.             if o==comma_word { o=and_word; }
  1562.             if o==and_word
  1563.             {   if k<2 { etype=6; break; }
  1564.                 if k>=6 { etype=6; break; }
  1565.                 if mmode==0 { put multinps byte 0 1;
  1566.                 put multinps byte 1 l; j=j-1; mmode=1; }
  1567.                 if amode==0 { amode=1; }
  1568.                 jump Olist;
  1569.             }
  1570.             wn=wn-1;
  1571.  
  1572.             .Resume;
  1573.             if allmode==2
  1574.             {   jump AllDone;
  1575.             }
  1576.             if mmode==1
  1577.             {   put ibuff byte j+2 0;
  1578.                 put pstack word pcount 0;
  1579.                 j=j+1;
  1580.             }
  1581.  
  1582.             .Back;
  1583.         }
  1584.     }
  1585.  
  1586.     .GiveError;
  1587.     if actor~=player
  1588.     {   special_number=TryNumber(wnbase);
  1589.         wn=wnbase;
  1590.         special_word=NextWord();
  1591.         action=#a$AnswerSub;
  1592.         inp1=1; inp2=actor; actor=player;
  1593.         ret#true;
  1594.     }
  1595.  
  1596.     if etype==1 { print "I didn't understand that sentence.^"; oops_from=1; }
  1597.     if etype==2 { print "I only understood you as far as wanting to ";
  1598.                   for m 0 to 7 { put pstack word m pspare-->m; }
  1599.                   pcount=pcounts;
  1600.                   Pcommand(0,1);
  1601.                   print ".^";
  1602.                 }
  1603.     if etype==3 { print "You can't see any such thing.^"; oops_from=e_oops; }
  1604.     if etype==4 { print "You seem to have said too little!^"; }
  1605.     if etype==5 { print "You aren't holding that!^"; oops_from=e_oops; }
  1606.     if etype==6 { print "You can't use multiple objects with that verb.^"; }
  1607.     if etype==7 { print "You can only use multiple objects once on a line.^"; }
  1608.     if etype==8 { print "I'm not sure what 'it' refers to.^"; }
  1609.     if etype==9 { print "You excepted something not included anyway!^"; }
  1610.     if etype==10 { print "You can only do that to something animate.^"; }
  1611.     if etype==11 { print "That's not a verb I recognise.^"; }
  1612.     jump Retry; 
  1613.  
  1614.     .Exceptions;
  1615.     o=NextWord();
  1616.     if o==the_word { jump Exceptions; }
  1617.     if o==cubes_word
  1618.     {   MultiFilter(is_cube);
  1619.         jump Exceptions;
  1620.     }
  1621.     if o==except_word { o=but_word; }
  1622.     if o==but_word { amode=2; jump Olist; }
  1623.     wn=wn-1;
  1624.     jump Resume;
  1625.  
  1626.     for i 1 to nwords
  1627.     {   j=parse-->(2*i-1);
  1628.         if j==0 { print "unknown "; }
  1629.         if j~=0 { print_addr j; print_char ' '; }
  1630.     }
  1631.     new_line;
  1632.  
  1633. ];
  1634.  
  1635. [ MultiAdd o i j;
  1636.   i=multinps->0;
  1637.   if i==16 { toomanyf=1; ret#true; }
  1638.   for j 1 to i
  1639.   {   if o==multinps->j { ret#true; }
  1640.   }
  1641.   i=i+1;
  1642.   put multinps byte i o;
  1643.   put multinps byte 0 i;
  1644. ];
  1645.  
  1646. [ MultiFilter attr i j o;
  1647.   .MFiltl;
  1648.   i=multinps->0;
  1649.   for j 1 to i
  1650.   {   o=multinps->j;
  1651.       if o hasnt attr { MultiSub(o); jump Mfiltl; }
  1652.   }
  1653. ];
  1654.  
  1655. [ MultiSub o i j k et;
  1656.   i=multinps->0;
  1657.   for j 1 to i
  1658.   {   if o==multinps->j
  1659.       {   for k j to i { put multinps byte k multinps->(k+1); }
  1660.           i=i-1;
  1661.           put multinps byte 0 i;
  1662.           et=0; return et;
  1663.       }
  1664.   }
  1665.   et=9; return et;
  1666. ];
  1667.  
  1668. [ DoAll domain i;
  1669.   mmode=1; put multinps byte 0 0;
  1670.   domain=child(domain);
  1671.   while domain~=0
  1672.   {   if domain hasnt concealed
  1673.       {   if domain hasnt worn
  1674.           { MultiAdd(domain); }
  1675.       }
  1676.       domain=sibling(domain);
  1677.   }
  1678. ];
  1679.  
  1680. [ Adjudicate context i j k l m n;
  1681.   j=match_p-1; k=0; l=matchlist->0;
  1682.   for i 0 to j
  1683.   {   n=matchlist->i;
  1684.       if n has concealed { jump NeverHaveIt; }
  1685.       m=parent(n);
  1686.       if context==1 { if m==actor { inc k; l=n; } }
  1687.       if context==3 { if m==actor { inc k; l=n; } }
  1688.       if context==4 { if m==actor { inc k; l=n; } }
  1689.       if context==5 { if m==actor { inc k; l=n; } }
  1690.       if context==6 { if n has animate { inc k; l=n; } }
  1691.       if context==0 { if m==location { inc k; l=n; } }
  1692.       if context==2 { if m==location { inc k; l=n; } }
  1693.       .NeverHaveIt;
  1694.   }
  1695.   if k==1 { return l; }
  1696.   if indef_mode==1 { return l; }
  1697.   ret#false;
  1698. ];
  1699.  
  1700. [ NounDomain domain1 domain2 context i j k oldw a;
  1701.   match_t=0; match_p=0; match_w=wn;
  1702.  
  1703.   NounD(domain1); NounD(domain2);
  1704.   wn=match_w+match_t;
  1705.   if match_p==0 { inc wn; ret#false; }
  1706.   if match_w <= nwords
  1707.   {   i=matchlist->0;
  1708.       if match_p==1 { return i; }
  1709.   }
  1710.   if match_p>1  { i=Adjudicate(context); }
  1711.  
  1712.   if i~=0
  1713.   {   if inferfrom==0 { inferfrom=pcount; }
  1714.       put pstack word pcount i;
  1715.       print "("; Pcommand(inferfrom,0); print ")^";
  1716.       return i;
  1717.   }
  1718.  
  1719.   if match_w > nwords { jump Incomp; }
  1720.  
  1721.   print "Which do you mean, ";
  1722.   j=match_p-1;
  1723.   for i 0 to j
  1724.   {   k=matchlist->i; Defart(k);
  1725.       if i<j-1 { print ", "; }
  1726.       if i==j-1 { print " or "; }
  1727.   }
  1728.   print "?^";
  1729.  
  1730.   .Whichl;
  1731.   a=Keyboard(buffer2, parse2);
  1732.  
  1733.   j=(parse2-->1);
  1734.  
  1735.   if j==both_word { j=all_word; }
  1736.   if j==everyt_word { j=all_word; }
  1737.   if j==all_word
  1738.   { print "Sorry, that's beyond my abilities.  Which one exactly?^"; jump Whichl; }
  1739.  
  1740.   j=j->4;
  1741.   if 0~=j&1
  1742.   {   Copy(buffer, buffer2);
  1743.       Copy(parse, parse2);
  1744.       k=1000; return k;
  1745.   }
  1746.   oldw=parse->1;
  1747.   put parse byte 1 a+oldw;
  1748.  
  1749.   k=oldw+a;
  1750.   while k>match_w
  1751.   {   i=k-a; MoveWord(k, parse, i);
  1752.       dec k;
  1753.   }
  1754.   for k 1 to a
  1755.   {   i=match_w+k-1; MoveWord(i, parse2, k);
  1756.   }
  1757.   k=1000; return k;
  1758.  
  1759.  
  1760.   .Incomp;
  1761.   print "What do you want ";
  1762.   if actor~=player { DefArt(actor); }
  1763.   print "to ";
  1764.   Pcommand(0,1);
  1765.  
  1766.   print "?^";
  1767.  
  1768.   a=Keyboard(buffer2, parse2);
  1769.  
  1770.   j=(parse2-->1);
  1771.  
  1772.   j=j->4;
  1773.   if 0~=j&1
  1774.   {   Copy(buffer, buffer2);
  1775.       Copy(parse, parse2);
  1776.       k=1000; return k;
  1777.   }
  1778.   oldw=parse->1;
  1779.  
  1780.   if inferfrom==0
  1781.   {   for k 1 to a
  1782.       {   i=match_w+k-1; MoveWord(i, parse2, k);
  1783.       }
  1784.   }
  1785.   if inferfrom~=0
  1786.   {   for k 1 to a
  1787.       {   i=match_w+k; MoveWord(i, parse2, k);
  1788.       }
  1789.       put parse2 word 1 Adjadd(inferword);
  1790.       MoveWord(match_w, parse2, 1);
  1791.       inc a; 
  1792.   }
  1793.   put parse byte 1 a+oldw;
  1794.   k=1000; return k;
  1795. ];
  1796.  
  1797. [ Pcommand from emptyf i j k f m n;
  1798.   if from==0
  1799.   {   i=parse-->1; from=1; f=1;
  1800.       if i==#w$invent { print "take an inventory"; jump vprinted; }
  1801.       if i==#w$examine { print "examine"; jump vprinted; }
  1802.       if i==#w$discard { print "discard"; jump vprinted; }
  1803.       print_addr i;
  1804.   }
  1805.   .vprinted;
  1806.   j=pcount-emptyf;
  1807.   for k from to j
  1808.   {   if f==1 { print_char ' '; }
  1809.       i=pstack-->k;
  1810.       if i==0 { print "those things"; jump eopcl; }
  1811.       if i==$ff { print "that"; jump eopcl; }
  1812.       if i<256 { Defart(i); }
  1813.       if i>=1000
  1814.       {   i=i-1000;
  1815.           print_addr Adjadd(i);
  1816.       }
  1817.       .eopcl;
  1818.       f=1;
  1819.   }
  1820. ];
  1821.  
  1822. [ Adjadd i n m;
  1823.   m=#adjectives_table;
  1824.   while 1==1
  1825.   {   n=m-->1;
  1826.       if n==i
  1827.       {   m=m-->0; return m;
  1828.       }
  1829.       m=m+4;
  1830.   }
  1831. ];
  1832.  
  1833. [ MoveWord at1 b2 at2 x y;
  1834.   x=at1*2-1; y=at2*2-1;
  1835.   put parse word x b2-->y;
  1836.   inc x; inc y;
  1837.   put parse word x b2-->y;
  1838. ];
  1839.  
  1840. [ NPutin obj thresh;
  1841.   if thresh < match_t { ret#true; }
  1842.   if thresh > match_t { match_t=thresh; match_p=0; }
  1843.   put matchlist byte match_p obj;
  1844.   inc match_p;
  1845. ];
  1846.  
  1847. [ NounD domain i j k o matched thresh;
  1848.   if domain==location { i=NounD(compass); }
  1849.  
  1850.   domain=child(domain);
  1851.   while domain~=0
  1852.   { if match_w > nwords { NPutin(domain,1); jump DontAccept; }
  1853.     wn=match_w;
  1854.     i=Noun();
  1855.     if i==1 { if itobj==domain { NPutin(itobj,1); } }
  1856.     if 0 == Refers(domain, i) { jump DontAccept; }
  1857.         thresh=0;
  1858.         .KGL; 
  1859.         inc thresh;
  1860.         o=NextWord(); if 0~=Refers(domain,o) { jump KGL; }
  1861.         NPutin(domain,thresh);
  1862.     .DontAccept;
  1863.     if domain has container
  1864.     {   if domain has open { jump DoDown; }
  1865.         if domain has interior { jump DontDown; }
  1866.         .DoDown;  k=child(domain);
  1867.           if k~=0  { k=NounD(domain); }
  1868.         .DontDown;
  1869.     }
  1870.     domain=sibling(domain);
  1871.   }
  1872.   ret#false;
  1873. ];
  1874.  
  1875. [ Refers o w j k l m;
  1876.     k=prop_addr(o,1); l=(prop_len(k)/2)-1;
  1877.     for m 0 to l
  1878.     {   j=k-->m; if w==j { ret#true; }
  1879.     }
  1880.     ret#false;
  1881. ];
  1882.  
  1883. [ Noun ncount i j;
  1884.   ncount=0;
  1885.   i=NextWord();
  1886.   if i==it_word { j=1; return j; }
  1887.   if i==them_word { j=1; return j; }
  1888.   if i==0 { ret#false; }
  1889.   j=i-->4;
  1890.   if j&128 == 0 { ret#false; }
  1891.  
  1892.   return i;
  1893. ];
  1894.  
  1895. [ Adjective parse i j;
  1896.   j=NextWord();
  1897.   if j==0 { ret#false; }
  1898.   i=j->4;
  1899.   if i&8 == 0 { ret#false; }
  1900.   return(j->5);
  1901. ];
  1902.  
  1903. [ NextWord i j k;
  1904.   if wn > (parse->1) { wn=wn+1; ret#false; }
  1905.   i=wn*2-1; wn=wn+1;
  1906.   j=parse-->i;
  1907.   if j==0
  1908.   {   k=wn*4-3; i=buffer->(parse->k);
  1909.       if i==',' { j=comma_word; }
  1910.   }
  1911.   return j;
  1912. ];
  1913.  
  1914. [ HitComma i j k l;
  1915.   l=wn-1;
  1916.   if l > (parse->1) { ret#false; }
  1917.   i=l*4;
  1918.   j=parse->i;
  1919.   k=parse->(i+1);
  1920.   k=k+j;
  1921.   print "Word "; print_num l; print " ends with ";
  1922.   .HCL;
  1923.   i=buffer->k;
  1924.   if i==' ' { inc k; jump HCL; }
  1925.   if i==',' {   print "a comma^";
  1926. k=1; return k; }
  1927.   print "no comma^";
  1928.   k=0; return k;
  1929. ];
  1930.  
  1931. [ Trynumber w i j c num len mul tot d digit;
  1932.   i=w*4+1; j=parse->i; num=j+buffer;
  1933.   len=parse->(i-1);
  1934.   if len>=4 { mul=1000; }
  1935.   if len==3 { mul=100; }
  1936.   if len==2 { mul=10; }
  1937.   if len==1 { mul=1; }
  1938.   tot=0; c=0; len=len-1;
  1939.   for c 0 to len
  1940.   {   digit=num->c;
  1941.       if digit=='0' { d=0; jump digok; }
  1942.       if digit=='1' { d=1; jump digok; }
  1943.       if digit=='2' { d=2; jump digok; }
  1944.       if digit=='3' { d=3; jump digok; }
  1945.       if digit=='4' { d=4; jump digok; }
  1946.       if digit=='5' { d=5; jump digok; }
  1947.       if digit=='6' { d=6; jump digok; }
  1948.       if digit=='7' { d=7; jump digok; }
  1949.       if digit=='8' { d=8; jump digok; }
  1950.       if digit=='9' { d=9; jump digok; }
  1951.       ret#false;
  1952.       .digok;
  1953.       tot=tot+mul*d;
  1954.       mul=mul/10;
  1955.   }
  1956.   return tot;
  1957. ];
  1958.  
  1959. [ Empty buff i size;
  1960.  
  1961.   size=buff->0;
  1962.   for i 1 to size { put buff byte i 0; }
  1963. ];
  1964.  
  1965. [ Copy bto bfrom i size;
  1966.  
  1967.   size=bto->0;
  1968.   for i 1 to size { put bto byte i bfrom->i; }
  1969. ];
  1970.  
  1971. [ Dump buff i;
  1972.  
  1973.   print "Dump at ";  HexOut(buff);  new_line;
  1974.   for i 0 to 31
  1975.   {   HexOut(buff->i); print " ";  }
  1976.   new_line;
  1977. ];
  1978.  
  1979. [ HexOut i j;
  1980.   j=(i/$10)/$10; if j ~= 0; { ; HexDig(j/$10); HexDig(j); } ; HexDig(i/$10); HexDig(i); ];
  1981. [ HexDig i;
  1982.   i=i % $10; if i<$a { print_char i+'0'; return; } print_char i+'a'-10;
  1983. ];
  1984.  
  1985. ! ---------------------------------------------------------------------------------------------------
  1986. ! The grammar table
  1987. ! ---------------------------------------------------------------------------------------------------
  1988.  
  1989. Verb "take" "get" "pick" "lift"      * "out"                          -> ExitSub
  1990.                                      * multi                          -> TakeSub
  1991.                                      * multiinside "from" noun        -> RemoveSub
  1992.                                      * "in" noun                      -> EnterSub
  1993.                                      * "off" held                     -> DisrobeSub;
  1994. Verb "stand"                         *                                -> ExitSub
  1995.                                      * "up"                           -> ExitSub;
  1996. Verb "remove" "shed"                 * held                           -> DisrobeSub
  1997.                                      * multiinside "from" noun        -> RemoveSub;
  1998. Verb "wear"                          * held                           -> WearSub;
  1999. Verb "put"                           * multiexcept "in" noun          -> InsertSub
  2000.                                      * multiexcept "into" noun        -> InsertSub
  2001.                                      * multiexcept "on" noun          -> InsertSub
  2002.                                      * "on" held                      -> WearSub
  2003.                                      * "down" multiheld               -> DropSub
  2004.                                      * multiheld "down"               -> DropSub;
  2005. Verb "insert"                        * multiexcept "in" noun          -> InsertSub
  2006.                                      * multiexcept "into" noun        -> InsertSub;
  2007. Verb "empty"                         * noun                           -> EmptySub
  2008.                                      * noun "to" noun                 -> EmptyTSub
  2009.                                      * noun "into" noun               -> EmptyTSub;
  2010. Verb "transfer"                      * noun "to" noun                 -> TransferSub;
  2011. Verb "drop" "throw" "discard"        * multiheld                      -> DropSub
  2012.                                      * multiexcept "in" noun          -> InsertSub
  2013.                                      * multiexcept "into" noun        -> InsertSub
  2014.                                      * multiexcept "down" noun        -> InsertSub
  2015.                                      * held "at" noun                 -> ThrowAtSub;
  2016. Verb "give" "pay" "offer" "feed"     * creature multiheld             -> GiveSub
  2017.                                      * multiheld "to" creature        -> GiveSub
  2018.                                      * "over" multiheld "to" creature -> GiveSub;
  2019. Verb "go" "walk" "run" "leave"       *                                -> VagueGoSub
  2020.                                      * noun                           -> GoSub
  2021.                                      * "through" noun                 -> EnterSub;
  2022. Verb "inventory" "i"                 *                                -> InvSub;
  2023. Verb "score"                         *                                -> ScoreSub;
  2024. Verb "look"                          *                                -> LookSub
  2025.                                      * "at" noun                      -> ExamineSub
  2026.                                      * "inside" noun                  -> SearchSub
  2027.                                      * "in" noun                      -> SearchSub
  2028.                                      * "under" noun                   -> LookUnderSub
  2029.                                      * "through" noun                 -> SearchSub;
  2030. Verb "open" "unwrap" "uncover" "undo"
  2031.                                      * noun                           -> OpenSub
  2032.                                      * noun "with" held               -> UnlockSub;
  2033. Verb "close" "shut" "cover"          * noun                           -> CloseSub;
  2034. Verb "enter"                         * noun                           -> EnterSub;
  2035. Verb "exit"                          *                                -> ExitSub;
  2036. Verb "examine" "x" "read" "watch" "descri" "check"
  2037.                                      * noun                           -> ExamineSub;
  2038. Verb "q" "quit" "die"                *                                -> QuitSub;
  2039. Verb "restore"                       *                                -> RestoreSub;
  2040. Verb "restart"                       *                                -> RestartSub;
  2041. Verb "save"                          *                                -> SaveSub;
  2042. Verb "script"                        *                                -> ScriptOnSub
  2043.                                      * "off"                          -> ScriptOffSub
  2044.                                      * "on"                           -> ScriptOnSub;
  2045. Verb "noscript"                      *                                -> ScriptOffSub;
  2046. Verb "yes" "y"                       *                                -> RhetSub;
  2047. Verb "no"                            *                                -> RhetSub;
  2048. Verb "sorry"                         *                                -> SorrySub;
  2049. Verb "shit" "fuck" "damn" "sod"      *                                -> StrongSub
  2050.                                      * special                        -> StrongSub;
  2051. Verb "bother" "curses" "drat" "darn" *                                -> MildSub
  2052.                                      * special                        -> MildSub;
  2053. Verb "search"                        * noun                           -> SearchSub;
  2054. Verb "wave"                          *                                -> WaveNSub
  2055.                                      * noun                           -> WaveSub;
  2056. Verb "set"                           * noun                           -> SetSub;
  2057. Verb "pull" "drag"                   * noun                           -> PullSub;
  2058. Verb "push" "move" "shift" "clear" "press"
  2059.                                      * noun                           -> PushSub
  2060.                                      * noun noun                      -> PushDirSub
  2061.                                      * noun "to" noun                 -> TransferSub;
  2062. Verb "turn" "rotate" "twist" "unscrew" "screw"
  2063.                                      * noun                           -> TurnSub
  2064.                                      * noun "on"                      -> SwitchonSub
  2065.                                      * noun "off"                     -> SwitchoffSub;
  2066. Verb "switch"                        * noun                           -> SwitchonSub
  2067.                                      * noun "on"                      -> SwitchonSub
  2068.                                      * noun "off"                     -> SwitchoffSub
  2069.                                      * "on" noun                      -> SwitchonSub
  2070.                                      * "off" noun                     -> SwitchoffSub;
  2071. Verb "lock"                          * noun "with" held               -> LockSub;
  2072. Verb "unlock"                        * noun "with" held               -> UnlockSub;
  2073. Verb "attack" "break" "smash" "hit" "fight" "wreck" "crack" "destro" "murder" "kill" "tortur"
  2074.                                      * noun                           -> AttackSub;
  2075. Verb "wait" "z"                      *                                -> WaitSub;
  2076. Verb "answer" "say" "shout" "speak"  * special "to" creature          -> AnswerSub;
  2077. Verb "ask"                           * creature "about" special       -> AskSub;
  2078. Verb "eat"                           * held                           -> EatSub;
  2079. Verb "sleep" "nap"                   *                                -> SleepSub;
  2080. Verb "peel"                          * noun                           -> TakeSub
  2081.                                      * "off" noun                     -> TakeSub;
  2082. Verb "sing"                          *                                -> SingSub;
  2083. Verb "climb" "scale"                 * noun                           -> ClimbSub;
  2084. Verb "buy" "purchase"                * special                        -> BuySub;
  2085. Verb "squeeze" "squash"              * noun                           -> SqueezeSub;
  2086. Verb "swim" "dive"                   *                                -> SwimSub;
  2087. Verb "swing"                         * noun                           -> SwingSub
  2088.                                      * "on" noun                      -> SwingSub;
  2089. Verb "blow"                          * held                           -> BlowSub;
  2090. Verb "pray"                          *                                -> PraySub;
  2091. Verb "echo"                          *                                -> EchoSub;
  2092. Verb "wake" "awake" "awaken"         *                                -> WakeSub
  2093.                                      * "up"                           -> WakeSub
  2094.                                      * creature                       -> WakeOSub
  2095.                                      * "up" creature                  -> WakeOSub;
  2096. Verb "kiss" "embrace" "hug"          * creature                       -> KissSub;
  2097. Verb "think"                         *                                -> ThinkSub;
  2098. Verb "smell" "sniff"                 *                                -> SmellSub
  2099.                                      * noun                           -> SmellSub;
  2100. Verb "hear" "listen"                 *                                -> ListenSub
  2101.                                      * noun                           -> ListenSub
  2102.                                      * "to" noun                      -> ListenSub;
  2103. Verb "taste"                         *                                -> TasteSub;
  2104. Verb "touch" "fondle" "feel" "grope" *                                -> TouchSub
  2105.                                      * noun                           -> TouchTSub;
  2106. Verb "rub" "shine" "polish"          * noun                           -> RubSub;
  2107. Verb "tie" "attach" "fasten" "fix"   * noun                           -> TieSub
  2108.                                      * noun "to" special              -> TieSub;
  2109. Verb "burn" "light"                  * noun                           -> BurnSub;
  2110. Verb "drink" "swallow" "sip"         * noun                           -> DrinkSub;
  2111. Verb "fill"                          * noun                           -> FillSub;
  2112. Verb "cut" "slice" "prune" "chop"    * noun                           -> CutSub;
  2113. Verb "jump" "skip" "hop"             *                                -> JumpsSub
  2114.                                      * "over" noun                    -> JumpSub;
  2115. Verb "xyzzy" "plugh" "plover" "blorple" *                             -> MagicWordSub;
  2116. Verb "shoot" "zap"                   * noun                           -> ShootSub;
  2117.  
  2118. ! ---------------------------------------------------------------------------------------------------
  2119.  
  2120. end;
  2121.